﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace University_Model
{
    class Students
    {
        public string firstName { get; }
        public string lastName;
        public DateTime dateOfBirth;
        public List<int> marks;
        public Students(string firstName, string lastName, DateTime dateOfBirth)
        {
            this.firstName = firstName;
            this.lastName = lastName;
            this.dateOfBirth = dateOfBirth;
            marks = new List<int>();

        }

        public void PrintStudentToConsole ()
        {
            Console.WriteLine("Студент(ка) {0} {1}, дата рождения: {2}, {3}, {4}", lastName, firstName, dateOfBirth.Day, dateOfBirth.Month, dateOfBirth.Year);
        }

        public void CalculateAverageMark (int rate, bool action)
        {
            int averageMark = 0;
            for (int i = 0; i < marks.Count; i++)
            {
                averageMark += marks[i];
            }
            int marksCount = marks.Count;
            averageMark = averageMark / marksCount;
            if (action == true)
            {
                if (averageMark > rate)
                {
                    PrintStudentToConsole();
                    Console.WriteLine("Средний балл - {0}", averageMark);
                }
            }
            else
                if (averageMark < rate)
            {
                PrintStudentToConsole();
                Console.WriteLine("Средний балл - {0}", averageMark);
            }

        }


    }

}
